<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link href="<s:url value="/css/style.css"/>" rel="stylesheet" type="text/css" />
<link href="<s:url value="/css/jquery.css"/>" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="<s:url value="/js/jquery.js"/>" ></script>
<script type="text/javascript" src="<s:url value="/js/jquery-ui.js"/>" ></script>
<script type="text/javascript" src="<s:url value="/js/common.js"/>" ></script>
<script type='text/javascript' src="<s:url value="/js/tableSel2.js"/>"></script>
<script type="text/javascript" src="../amcolumn/swfobject.js"></script>
<script type="text/javascript">
function goSearch(){

	$('#listForm').submit();
}
 
function goExport(form){
	form = document.getElementById('listForm');
	 temp = form.action;
		form.action=form.action.replace('list','export');
		 
		form.submit();
	 form.action = temp;
}
$(function(){
	$('#start').datepicker({dateFormat:'yy-mm-dd'});
	$('#end').datepicker({dateFormat:'yy-mm-dd'});
});
</script>
<title><s:text name="system.title" /></title>
</head>
<body>
<s:include value="/common/up.jsp"></s:include>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td class="box">
    <s:form action="RevenueByChannel/list" name="listForm" id="listForm" namespace="/report">
	  <table width="100%" border="0" cellpadding="0" cellspacing="0" class="searchbg">
      <tr>
        <td><s:date name="start" format="yyyy-MM-dd" var="xx"/><s:date name="end" format="yyyy-MM-dd" var="x2"/>
        From:<s:textfield name="start" id="start" cssClass="input2" size="10" value="%{xx}" onFocus="$('#flashMode').hide();$('#tableMode').show();$('#mode').attr('checked',false)" /> &nbsp;&nbsp;To:<s:textfield value="%{x2}" name="end" id="end" cssClass="input2" size="10" onFocus="$('#flashMode').hide();$('#tableMode').show();$('#mode').attr('checked',false)"/>
		   &nbsp;<img onClick="javascript:goSearch();" src="<s:url value="/img/right/btns.gif"/>" border="0" align="absmiddle" />
			<img onClick="goExport(this.form);" src="<s:url value="/img/right/Export.gif"/>" border="0" align="absmiddle" />
			<input id="mode" type="checkbox" onClick="changeReportMode(this)"/> 图表模式  <input type="button" value="Channels" onClick="$('#ccs').show();$('#flashMode').hide();$('#tableMode').show();$('#mode').attr('checked',false)"/>
			<div id="ccs" style="display:none; position:absolute; left:10px;top:50px; background-color:#fff;"> <s:select multiple="true" name="allChannel" list="ccs" cssStyle="width:200px;height:200px;"></s:select> <br/> <input type="button" value="close" onClick="$('#ccs').hide();"/> </div>
		  
        </tr>
      </table>
	  <div id="tableMode">
      <table width="100%" border="0" cellpadding="0" cellspacing="1" class="box2 activeTable" >
        <tr>
          <td class="tablecolour1" width="250">Ad Channel</td>
          <td class="tablecolour1" width="250">Revenue(From <s:date name="start" format="yyyy-MM-dd" /> To <s:date name="end" format="yyyy-MM-dd" /> )</td>
          <td class="tablecolour1">Revenue(From <s:date name="lastStart" format="yyyy-MM-dd" /> To <s:date name="lastEnd" format="yyyy-MM-dd" /> )</td>
        </tr>
        <s:iterator value="result" status="status" var="l">
        	<tr>
        		  <td class="tablecolour2"><s:property value="title" /></td>
        		  <td class="tablecolour2"><s:property value="currentSum" /></td>
        		  <td class="tablecolour2"><s:property value="lastSum" /></td>
        	</tr>
        </s:iterator>
      </table>
	  </div>
	   <div id="flashMode" style="display:none;width:100%;height:600px;">
	  
	<div id="flashcontent">
		<strong>You need to upgrade your Flash Player</strong>
	</div>

	<script type="text/javascript">
		// <![CDATA[	
		var so = new SWFObject("../amcolumn/amcolumn.swf", "amcolumn", "100%", "100%", "0", "#fff");
		so.addVariable("path", "../amcolumn/");
		so.addVariable("settings_file", encodeURIComponent("amcolumn_settings.xml"));
		so.addVariable("data_file", encodeURIComponent("xml?start=<s:date name="start" format="yyyy-MM-dd" />&end=<s:date name="end" format="yyyy-MM-dd" /><s:iterator value="allChannel" status="status" var="l">&allChannel=<s:property value="l"/></s:iterator>"));
		so.addVariable("preloader_color", "#ffffff");
		so.write("flashcontent");
		// ]]>
	</script>
	  </div>
      </s:form>
    </td>
  </tr>
</table>
<s:include value="/common/down.jsp"></s:include>
</body>
</html>